﻿#ifdef WIN32
#pragma execution_character_set("utf-8")
#endif

#ifndef DAddHomeworkView_H
#define DAddHomeworkView_H

#include <QComboBox>
#include <QDateTimeEdit>
#include <QDialog>
#include <QObject>
#include <QScrollArea>
#include <QTableWidget>
#include <QTreeWidget>

#include "DHeader.h"

class DAddHomeworkView : public QDialog
{
    Q_OBJECT
public:
    explicit DAddHomeworkView(QWidget* parent = nullptr);

    QTableWidget* getTreeWgt() { return m_table; }
    QDate getDate() { return m_dtCurrent->date(); }

    void initUI(const std::vector<DAddHomework>& vecAdd, const QDate& dt,
                const std::vector<DHomeworkType>& vecType, IDHomeworkType type);

    void updateUI(const std::vector<DAddHomework>& vecAdd);

signals:
    void signalChangeHomework(QDate dt, IDHomeworkType type);
    void signalSubmit(QDate dt, IDHomeworkType type,
                      std::vector<DAddHomework> vecAdd);

public slots:
    void slotSubmit();
    void slotSelectAll();

private:
    void resetTable();

private:
    QCheckBox* m_pCheckAll = nullptr;
    QDateEdit* m_dtCurrent = nullptr;
    QTableWidget* m_table = nullptr;
    QComboBox* m_pCombBox = nullptr;
};

#endif  // DAddHomeworkView_H
